<?php

namespace App\Http\Requests;


class CustomerRequest extends BaseRequest
{

    public function rules()
    {
        return [
            'username' => 'required|between:1,32|unique:sys_users,username,'.$this->post('id'),
            'nickname' => 'required|between:1,255',
            'password' => 'sometimes|required|between:1,32',
            'status' => 'required',

            'money' => 'sometimes|required|numeric',
        ];
    }

    public function messages()
    {
        return [
            'username.required' => '用户名称必须填写',
            'username.between' => '用户名称1-32个字符之间',
            'username.unique' => '用户名称已存在',
            'nickname.between' => '用户昵称1-255个字符之间',
            'nickname.required' => '用户昵称已存在',
            'password.required' => '用户密码必须填写',
            'password.between' => '用户密码1-32个字符之间',
            'status.required' => '请选择状态',
            'money.required' => '请填写金额',
            'money.numeric' => '金额请填写数值形式',

        ];
    }
}
